from django.db import models

#导入时间域
from django.utils import timezone

#基类
class Base(models.Model):

	#创建时间
	create_time = models.DateTimeField(default=timezone.now,null=True)

	class Meta:
		abstract = True

#用户类
class User(Base):

	id = models.AutoField(primary_key=True)
	username = models.CharField(max_length=100)
	password = models.CharField(max_length=200)
	password1 = models.CharField(max_length=200)
	num = models.IntegerField(default=1)
	pthone = models.CharField(max_length=11)
	emial = models.EmailField(default=None)
	img = models.ImageField(upload_to='static/upload')
	class Meta:
		db_table = "user"

class DingUser(models.Model):
	username = models.CharField(max_length=30)
	union = models.CharField(max_length=60)
	ding = models.CharField(max_length=60)
	open = models.CharField(max_length=60)

	class Meta:
		db_table = 'ding'


# class Cate(models.Model):
#    name = models.CharField(max_length=30)
#    pid = models.IntegerField()
#
#    class Meta:
#       db_table = 'cate'

class Course(Base):
	id =models.AutoField(primary_key=True)
	title = models.CharField(max_length=32)
	desc = models.CharField(max_length=325)
	price = models.IntegerField()
	video = models.IntegerField()
	cid = models.CharField(max_length=225)

	class Meta:
		db_table = 'courses'





# class Cate_Course(models.Model):
#    user = models.ForeignKey(User,on_delete=models.CASCADE)
#    course = models.ForeignKey(Course,on_delete=models.CASCADE)
#
#    class Meta:
#       db_table = 'cate_course'

